package com.kb.order.service.impl;

import com.kb.order.dao.OrderDetailDao;
import com.kb.order.dao.OrderFoodDao;
import com.kb.order.dao.ShopInfoDao;
import com.kb.order.pojo.Order;
import com.kb.order.service.IOrderService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

import com.kb.order.dao.OrderDao;

@Service
public class OrderService implements IOrderService {

    @Resource
    private OrderDao orderDao;
    @Resource
    private OrderFoodDao orderFoodDao;
    @Resource
    private OrderDetailDao orderDetailDao;

    public int insert(Order pojo){
        return orderDao.insert(pojo);
    }

    public int insertList(List< Order> pojos){
        return orderDao.insertList(pojos);
    }

    public List<Order> select(Order pojo){
        return orderDao.select(pojo);
    }

    public int update(Order pojo){
        System.out.println(pojo);
        return orderDao.update(pojo);
    }

    @Override
    public void celOrder(String orderId) {
        //删除订单主表
        orderDao.delete(orderId);
        //删除订单商品表
        orderFoodDao.delete(orderId);
        //删除订单
        orderDetailDao.delete(orderId);
    }


}
